 /* global getCookie */
$.get('/antique/api/sysUser/query_my_wallet', { token : getCookie('token') }, function (result) {
    if ( result.code == 0) {
       $(".balance").html("提现金额:(可提现￥" + result.data.balance + ")");
    }
});

function withdraw(){
    var money = $("#money").val();
    var realName = $("#realName").val();   
    if (money == '' || money <= 0){
        $.toast("金额不能为空", "cancel");
        return;
    }
    if (realName == ''){
        $.toast("姓名不能为空", "cancel");
        return;
    }
    var params = {};
    params.money = money;
    params.realName = realName;
    params.token = getCookie('token');
    $.ajax({
        type:'POST',
        url:"/antique/api/userWithdraw/withdraw_to_weixin",
        data: params,
        dataType:"json",
        success:function(res){
            if (res.code == 0){
                $.toast("提现成功!");
                window.location.reload();
             } else {
                $.toast(res.message, "cancel");
            }            
        }
    });  
} 